package shiyan12;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;

public class Main {

	public static void main(String[] args) throws IOException {
		String src = "d:/EncodeTest.txt";
		String dst = "d:x.txt";
		convertGBK2UTF8(src,dst);
	}
	
	public static void convertGBK2UTF8(String src, String dst) throws IOException{
		BufferedReader br = null;
		try {
			br = new BufferedReader(new FileReader(src));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(src), "UTF-8");
		String line = null;
		while((line=br.readLine())!=null){
			osw.write(line);
		}
		br.close();
		osw.close();
	}//201521123039
}
